<template>
  <div class="paging">
    <div class="block">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :background="true"
        :page-sizes="[3, 5, 7]"
        :pager-count="5"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    handleSizeChange(val) {
      this.limit = val;
      this.$emit("getLimit", this.limit);
    },
    handleCurrentChange(val) {
      this.page = val;
      this.$emit("getPage", this.page);
    },
  },
  data() {
    return {
      currentPage: 1,
      limit: 3,
      page: 1,
    };
  },
  props: {
    total: Number,
  },
  created() {},
};
</script>

<style>
.paging {
  float: right;
  margin: 20px;
}
</style>